import request from "./request.js"

function updateUserInformation(uid, updatedUserInfo) {
	const url = `/api/update/user/${uid}`;
	return request.patch(url, updatedUserInfo)
		.then(response => {
			return response.data;
		})
		.catch(error => {
			// 处理请求错误
			console.error('更新用户信息失败:', error);
			throw error;
		});
}

function follow(params) {
	return request.post('/api/follow', {
		params: params
	})
}

function unfollow(params) {
	return request.post('/api/unfollow', {
		params: params
	})
}

function getFollow(id) {
	return request.get('/api/getFollow', {
		params: {
			_id: id
		}
	})
}

function getUserAnswer(id) {
	return request.get('/api/getUserAnswer', {
		params: {
			_id: id
		}
	})
}
module.exports = {
	updateUserInformation,
	follow,
	unfollow,
	getFollow,
	getUserAnswer
}